<template>
  <div :class='{"award":true,isChecked:searchInfo.state==1}'>
    <Search :search="searchInfo" :getListData="getListData" :pageInfo="pageInfo" :columnsData="selectData.data1 | formaltColumns" />
    <List :listData="listData" @forMore="getMoreInfo">
      <ListModel :search="searchInfo" :listData="listData" :routerDetail="routerDetail" />
    </List>
    <div v-show="searchInfo.state==0" class="btn-box"><van-button type="primary" class="bc-green" @click="submit" >确定</van-button></div>
  </div>
</template>
<script>
import Search from "./model/search.vue"
import MixIns from '../../../../mixin/mixin.js'
import List from '../../../../components/list.vue'
import ListModel from "./model/awardList"
export default {
  components: {Search,List,ListModel},
  name: "",
  data() {
    return {
      searchInfo:{
        state:0,
        classify:"",
      }
    };
  },
  filters:{
    formaltColumns(val){
      var data=[].concat(...val)
      return ["全部"].concat(data)
    }
  },
  methods: {
    submit(){
      var params=[]
      this.listData.forEach(ele=>{
        params.push({
          id:ele.id,
          state:ele.isPassed?1:9,
          type:ele.type
        })
      })
      _g.toMessage({error:1,msg:"asdfasdf"})
      _g.apiPost("ratify/savestudentaward",{data:JSON.stringify(params)}).then(res=>{
        _g.toMessage(res)
        if(!res.error){
          this.pageInfo.page=1
          setTimeout(()=>{
            this.getListData()
          },600)
        }
      })
    }
  },
  created() {},
  mixins:[MixIns]
};
</script>
<style lang="scss" scoped>
.award {
  height: calc(100% - 120px);

  .btn-box{
    padding: 20px;
    box-shadow: 0px -2px 2px 0px #ddd;

    .bc-green{
      width: 100%;
    }
  }
}
.isChecked{
  height: calc(100% + 20px);
}
</style>